package logic

import (
	"context"
	"gitee.com/shijun123456/srpcinterface/client/votes"

	"gitee.com/shijun123456/api-votes/internal/svc"
	"gitee.com/shijun123456/api-votes/internal/types"

	"github.com/tal-tech/go-zero/core/logx"
)

type ActivityinfoLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewActivityinfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) ActivityinfoLogic {
	return ActivityinfoLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *ActivityinfoLogic) Activityinfo(req types.Accid) (*types.ActivityResp, error) {
	// todo: add your logic here and delete this line

	//这里进行请求rpc服务想你想
	args := &votes.ActInfoReq{Actid: req.Accid}
	res, err := l.svcCtx.Voter.GetActivityInfo(l.ctx, args)
	if err != nil {
		return nil, err
	}

	//新大陆信息处理
	argsGetPayinfo := &votes.ArgsGetPayInfo{
		OrderNo: "10010",
	}
	reply, err := l.svcCtx.Xindalu.GetInfo(l.ctx, argsGetPayinfo)
	if err != nil {
		return nil, err
	}
	l.Logger.Infof("getPayinfoReply: %s", reply.Data.OrderNo)

	return &types.ActivityResp{
		Accid: res.Actid,
	}, nil
}
